package edu.ynu.e_platform.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import edu.ynu.e_platform.common.entity.LogicEntity;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * @author manwen Yang
 */
@Entity
@Getter
@Setter
@JsonIgnoreProperties(value = {"handler","hibernateLazyInitializer","fieldHandler"})
@Where(clause = "isDeleted = 0")  //逻辑删除,过滤掉删除标记不为0的
public class ShopItem extends LogicEntity {

    /**
     *  上架状态 默认为0不上架；1为上架
     */
    @Column(columnDefinition = "INT default 0")
    private Integer itemStatus;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"shopItems","orders","business"})
    private Shop shop;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"shopItems","lineItem","business"})
    private Item item;

}
